var currentpage = 1,totlepage = 1,i;//分页的当前页和总的页数
//自定义报表数据
var tableData = [],schoolDataList = [],schoolDataAll = [];
//报表对应的数据
var otherData = {tableName:'',pageLeft:0,pageRight:0};
var Page = React.createClass({
    setPage: function (e) {
        setPage($(e.target).html());
        this.props.onPageClick(1);
    },
    showPage: function () {
        showPage();
    },
    render: function () {
        {
            var items = [],
                svar = this;
            if(totlepage == 0 ){
                items.push({num:1,checked:true})
            }else if(totlepage < 6){
                for(i = 1;i <= totlepage ;i++) {
                    if (i == currentpage) {
                        items.push({num:i,checked:true})
                    } else {
                        items.push({num:i,checked:false})
                    }
                }
            }else if(currentpage >= (totlepage-2)) {//点在左边
                items.push({num:1,checked:false});
                items.push({num:'···',checked:false});
                for(i = totlepage-2;i <= totlepage ;i++){
                    if(i == currentpage){
                        items.push({num:i,checked:true})
                    }else{
                        items.push({num:i,checked:false})
                    }
                }
            }else if(currentpage <= 3){
                for(i = 1;i <= 3 ;i++) {
                    if (i == currentpage) {
                        items.push({num:i,checked:true})
                    } else {
                        items.push({num:i,checked:false})
                    }
                }
                items.push({num:'···',checked:false});
                items.push({num:totlepage,checked:false})
            }else {//点在两边
                items.push({num:1,checked:false});
                items.push({num:'···',checked:false});
                items.push({num:currentpage-1,checked:false});
                items.push({num:currentpage,checked:true});
                items.push({num:currentpage+1,checked:false});
                items.push({num:'···',checked:false});
                items.push({num:totlepage,checked:false})
            }
        }
        return (
            <div className="tableInfo-page">
                <div className="page-number">每页<span className="page-number-list" onClick={this.showPage}>{pagecount}</span>条</div>
                <div className="page-list" style={{top:pageListTop+"px"}}>
                    <ul>
                        {
                            pageList.map(function (item) {
                                return (<li onClick={svar.setPage}>{item}</li>)
                            })
                        }
                    </ul>
                </div>
                <div className="page-limit">
                    <ol className="page-limit-ol">
                        <li className="page-limit-img" name="-1" onClick={otherData.pageLeft == 0?'':svar.props.onPageClick.bind(svar,-1)}><span className={otherData.pageLeft == 0?'page-limit-left-no':'page-limit-left-yes'}/></li>
                        {
                            items.map(function (item) {
                                return (<li  onClick={isNaN(item.num)?'':svar.props.onPageClick.bind(svar,item.num)}  className={item.checked == true?'page-limit-num page-limit-checked':'page-limit-num'} name={item.num} >{item.num}</li>)
                            })
                        }
                        <li className="page-limit-img" name="-2" onClick={otherData.pageRight == 0?'':svar.props.onPageClick.bind(svar,-2)}><span className={otherData.pageRight == 0?'page-limit-right-no':'page-limit-right-yes'}/></li>
                    </ol>
                </div>
            </div>
        );
    },
});
//表单组件
var Table = React.createClass({
    render: function () {
        return (
            <tr onClick={this.props.onClickShowSafeArea}>
                <td>{parseInt(this.props.listNumber)+1}</td>
                <td>{this.props.regionname}</td>
                <td >{this.props.regionaddr}</td>
                <td >{this.props.radius}</td>
                {
                    /**
                     * <td ></td>
                     */
                }
                <td >{this.props.createtime}</td>
                <td >{this.props.createuser}</td>
                <td><div className="trButton table-select trLeft" onClick={this.props.onClickUpdate}>修改</div><div className="trButton table-delete trLeft" onClick={this.props.onClickDelete}>删除</div></td>
            </tr>
        );
    }
});
//父组件
var Main = React.createClass({
    //组件初始状态
    getInitialState: function () {
        return {otherData:this.props.otherData,tableData:this.props.tableData}
    },
    componentDidMount: function () {
        //使用ajax取出数据然后组装数据列表
        $("#addressName").val("学校");
        //地图显示的高度
        $(".map").css("height","360px");
        this.loadScript();//异步加载百度地图
        this.setState({tableData:tableData,otherData:otherData});
        //绑定回车时间
        var svar = this;
        $(document).keypress(function(e) {
            var eCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
            if (eCode == 13){
                if($(".enterEvent").is(":focus")){
                    if(document.getElementById("popupFrame") == null){
                        svar.onClickQuery();
                    }
                }
            }
        });
    },
    //异步加载百度地图
    loadScript: function () {
        var script = document.createElement("script"),svar = this;
        script.src = "http://api.map.baidu.com/api?v=2.0&ak=csjf0Mv4PUoe61rIrQzd1dgKHhzXr3Vv&callback=initialize";//此为v2.0版本的引用方式
        document.body.appendChild(script);
        setTimeout(function () {
            suixun.ajax(serverUrl+'/schoolManage/querySchool.json','',"get",function(data){
                if(data.code == 200 ){
                    for(var i=0;i<data.info.length;i++){
                        var obj=data.info[i];
                        schoolDataList[i] = {key:i,id:obj.id,schoolname:obj.schoolname};
                    }
                    schoolDataAll = schoolDataList;
                    svar.setState({schoolDataList:schoolDataList,schoolDataAll:schoolDataAll});
                }else{
                    svar.setState({schoolDataList:schoolDataList,schoolDataAll:schoolDataAll});
                }
            });
        },500);
    },
    //查询学校数据
    selectSchoolData: function () {
        suixun.showLoding();//显示加载中
        var svar = this;
        suixun.ajax(serverUrl+'/schoolManage/querySchool.json','',"get",function(data){
            suixun.hideLoding();//隐藏加载中
            if(data.code == 200 ){
                for(var i=0;i<data.info.length;i++){
                    var obj=data.info[i];
                    schoolDataList[i] = {key:i,id:obj.id,schoolname:obj.schoolname};
                }
                schoolDataAll = schoolDataList;
                svar.setState({schoolDataList:schoolDataList,schoolDataAll:schoolDataAll});
            }else{
                svar.setState({schoolDataList:schoolDataList,schoolDataAll:schoolDataAll});
            }
        });
    },
    //分页
    onPageClick: function (num) {
        //分页-调用ajac然后把数据查询出来:获取name的值
        //计算currentpage
        suixun.showLoding();//显示加载中
        var onPageLeft = 0,onPageRight = 1,svar = this;
        if(num > 0){
            currentpage = num;
        }else if(num == -1 && currentpage > 1){
            currentpage --;
        }else if(num == -2  && currentpage < totlepage){
            currentpage ++;
        }
        //修改左右的按钮
        if((currentpage == totlepage && totlepage == 1)|| totlepage == 0){
            onPageLeft = 0;
            onPageRight = 0;
        }else if(currentpage == totlepage && totlepage > 1){
            onPageLeft = 1;
            onPageRight = 0;
        }else if(1 < currentpage && currentpage < totlepage){
            onPageLeft = 1;
            onPageRight = 1;
        }
        var queryType = $(".school-or-table").html(),queryKey = "schoolname";
        if(queryType == "设备IMEI号"){
            queryKey = "mdtid";
        }else if(queryType == "设备手机号"){
            queryKey = "simid";
        }
        var param="param={";
        param = getJsonDataNotEmpty(param,""+queryKey+"",$(".queryVal").val());
        param = getJsonDataNotEmpty(param,"pagenumber",""+currentpage+"");
        param = getJsonDataNotEmpty(param,"pagecount",pagecount+'');
        param += "}";
        suixun.ajax(serverUrl+'/monitorManager/querySafeRegionList.json',param,"get",function(data){
            tableData = [];
            if(data.code == 200 && data.info.queryresult != null ){
                for(var i=0;i<data.info.queryresult.length;i++){
                    var obj=data.info.queryresult[i];
                    tableData[i] = {
                        keyid:i,
                        regionid:obj.regionid,
                        regionname:obj.regionname,
                        regionaddr:obj.regionaddr,
                        radius:obj.radius,
                        createuser:obj.createuser,
                        regiontype:obj.regiontype,
                        createtime:obj.createtime,
                        minlon:obj.minlon,
                        minlat:obj.minlat,
                        maxlon:obj.maxlon,
                        maxlat:obj.maxlat,
                        centerlon:obj.centerlon,
                        centerlat:obj.centerlat,
                    };
                }
                if(tableData.length == 0){
                    onPageLeft = 0;onPageRight = 0;
                }else if(data.info.totlepage > 1 && data.info.totlepage > currentpage){
                    onPageRight = 1
                }else{
                    onPageRight = 0;
                }
                otherData = {pageLeft:onPageLeft,pageRight:onPageRight};
                totlepage = data.info.totlepage;//初始化的时候赋值：分页的当前页和总的页数
                svar.setState({tableData:tableData,otherData:otherData});
                suixun.hideLoding();//隐藏加载中
            }else{
                otherData = {pageLeft:0,pageRight:0};
                currentpage = 1;totlepage = 1;//初始化的时候赋值：分页的当前页和总的页数
                svar.setState({tableData:tableData,otherData:otherData});
                suixun.hideLoding();//隐藏加载中
            }
        });
    },
    //修改——赋值给输入框
    onClickUpdate: function (info) {
        $(".popAddMessage").show();//弹出层
        updateregionid = info[1];
    },
    //删除
    onClickDelete: function (regionid) {
        var svar = this;
        suixun.confirm_noTit("是否确定删除？",function (data) {
           if(data){
               suixun.showLoding();//显示加载中
               var param="param={";
               param = getJsonDataNotEmpty(param,"regionid",""+regionid+"");
               param += "}";
               suixun.ajax(serverUrl+'/monitorManager/deleteSafeRegion.json',param,"get",function(data){
                   suixun.hideLoding();//隐藏加载中
                   if(data.code == 200){
                       suixun.alert(data.info,function (data) {
                           if(data){
                               removeOverlay(markerStrom);//移除上一个覆盖物
                               var tbodyData = $("#tbodyData").children();
                               if(tbodyData.length == 1 && currentpage > 1){
                                   totlepage = totlepage - 1;
                                   svar.onPageClick(currentpage-1);//更新数据
                               }else{
                                   svar.onPageClick(currentpage);//更新数据
                               }
                           }
                       });
                   }
               });
           }
        });
    },
    //点击菜单
    onClickMenu: function () {
        window.location.href = "queryMonitorListDetail.html";
    },
    //新增安全列表
    onClickAdd: function () {
        updateregionid = "";//修改时的id
        $(".popAddMessage").show();
    },
    //关闭列表
    onClickHidePop: function () {
        $(".popAddMessage").hide();
    },
    //保存
    saveMap: function () {
        var svar = this;
        saveMap(function (data) {
            if(data){
                //赋值给搜索框
                svar.onPageClick(currentpage);
                $("#suggestId").val("");
            }
        });//调用外部的保存方法
        //然后在刷新分页

    },
    //修改
    updateMap: function () {
        var svar = this;
        saveMap(function (data) {
            if(data){
                //赋值给搜索框
                svar.onPageClick(currentpage);
                $("#suggestId").val("");
            }
        });//调用外部的保存方法
        //然后在刷新分页
    },
    /**
     * 点击搜索学校下拉列表
     */
    onClickQuerySchoolList: function (e) {
        $(".queryVal").val($(e.target).html());
        this.onClickQuery();
    },
    /**
     * 点击搜索
     */
    onClickQuery: function () {
        var svar = this;
        var queryVal = $(".queryVal").val();
        if(queryVal == ""){
            $(".tableInfo").hide();
        }
        var queryType = $(".school-or-table").html(),queryKey = "schoolname",inputValue = $(".queryVal").val(),type = 1;
        if(queryType == "设备IMEI号"){
            queryKey = "mdtid";
            type = 2;
            if(!/^[1-9]\d*$/.test(inputValue) && inputValue != ""){
                suixun.alert("设备IMEI号格式不对！",function (data) {
                    if(data){
                        $(".queryVal").val("")
                    }
                });
                return;
            }
        }else if(queryType == "设备手机号"){
            queryKey = "simid";
            type = 3;
            if(!/^[1-9]\d*$/.test(inputValue) && inputValue != ""){
                suixun.alert("设备手机号格式不对！",function (data) {
                    if(data){
                        $(".queryVal").val("")
                    }
                });
                return;
            }
        }
        suixun.showLoding();//显示加载中
        map.clearOverlays();//清除地图上所有覆盖物
        var param="param={";
        param = getJsonDataNotEmpty(param,""+queryKey+"",'"'+queryVal+'"');
        param += "}";
        var url = serverUrl+'/monitorManager/queryMapMonitorList.json';
        if($(".queryVal").val() != ""){
            url = url +"?"+param;
        }
        suixun.ajax(url,'',"get",function(data){
            suixun.hideLoding();//隐藏加载中
            if(data.code == 200 && data.info != null ){
                if(data.info.length == 0){
                    var point = new BMap.Point(104.073516,30.549619);
                    map.centerAndZoom(point, 17);
                    return;
                }
                if(data.info[0].lon != 0 && data.info[0].lat != 0 && data.info[0].lon != null){
                    var point = new BMap.Point((parseFloat(data.info[0].lon)+parseFloat(data.info[0].lonx))/1000000,(parseFloat(data.info[0].lat)+parseFloat(data.info[0].laty))/1000000);
                    //设置中心点坐标和地图级别。-地图初始化
                    map.centerAndZoom(point, 17);
                }
                for (var i = 0; i < data.info.length; i++) {
                    var lon = (parseFloat(data.info[i].lon)+parseFloat(data.info[i].lonx))/1000000;
                    var lat = (parseFloat(data.info[i].lat)+parseFloat(data.info[i].laty))/1000000;
                    if(lon != 0 && lat != 0){
                        var maker = addMarker(new window.BMap.Point(lon, lat), i);
                        //位置 ，经度，纬度，最后上线时间,alarmtype(报警的值为20 代表电量)，电量的值为1,2,3,4，以25%为基准比例）,学生id
                        addInfoWindow(maker, data.info[i].objectid,lon,lat,data.info[i].maxrecvtime,data.info[i].alarmtype,data.info[i].alarmvalue);
                    }
                }
                if(queryVal != ""){
                    $(".tableInfo").show();//显示安全区域
                }
                //查询安全区域列表
                param="param={";
                param = getJsonDataNotEmpty(param,""+queryKey+"",$(".queryVal").val());
                param = getJsonDataNotEmpty(param,"pagenumber","1");
                param = getJsonDataNotEmpty(param,"type",""+type+"");
                param = getJsonDataNotEmpty(param,"pagecount",pagecount+'');
                param += "}";
                suixun.ajax(serverUrl+'/monitorManager/querySafeRegionList.json',param,"get",function(data){
                    var pageRight = 0;
                    tableData = [];
                    suixun.hideLoding();//隐藏加载中
                    if(data.code == 200){
                        if(data.info.queryresult == null){
                            return;
                        }
                        for(var i=0;i<data.info.queryresult.length;i++){
                            var obj=data.info.queryresult[i];
                            tableData[i] = {
                                keyid:i,
                                regionid:obj.regionid,
                                regionname:obj.regionname,
                                regionaddr:obj.regionaddr,
                                radius:obj.radius,
                                createuser:obj.createuser,
                                regiontype:obj.regiontype,
                                createtime:obj.createtime,
                                minlon:obj.minlon,
                                minlat:obj.minlat,
                                maxlon:obj.maxlon,
                                maxlat:obj.maxlat,
                                centerlon:obj.centerlon,
                                centerlat:obj.centerlat,
                            };
                        }
                        if(data.info.totlepage > 1){
                            pageRight = 1
                        }
                        otherData = {pageLeft:0,pageRight:pageRight};
                        currentpage = 1;totlepage = data.info.totlepage;//初始化的时候赋值：分页的当前页和总的页数
                        svar.setState({tableData:tableData,otherData:otherData});
                    }else{
                        otherData = {pageLeft:0,pageRight:0};
                        currentpage = 1;totlepage = 1;//初始化的时候赋值：分页的当前页和总的页数
                        svar.setState({tableData:tableData,otherData:otherData});
                    }
                });
            }else{
                suixun.alert("没有学生数据!");
                // $(".enterEvent").blur();//移除搜索框的焦点
                var point = new BMap.Point(104.073516,30.549619);
                map.centerAndZoom(point, 13);
                //没有查询到结果
                $(".tableInfo").hide();
            }
        });
    },
    //改变弹出层学校输入框
    onChangSchoolInput: function (e) {
        if($(".school-or-table").html() == "设备IMEI号" || $(".school-or-table").html() == "设备手机号"){
            return;
        }
        var val = $(e.target).val();
        if(val != ""){
            this.schoolArray(val,$(e.target).attr("data-list"));
        }else{
            $("."+$(e.target).attr("data-list")+"").hide();
        }
    },
    //排序
    schoolArray: function (val,cls) {
        schoolDataList = [];
        for(var i = 0;i < schoolDataAll.length;i++){
            if((schoolDataAll[i].schoolname).indexOf(val) >= 0){
                schoolDataList.push({schoolname:schoolDataAll[i].schoolname});
            }
        }
        if(schoolDataList.length == 0){
            $("."+cls+"").hide();
        }else{
            $("."+cls+"").show();
            this.setState({schoolDataList:schoolDataList});
        }
    },
    //点击学校输入框
    onClickSchool: function (e) {
        if($(".school-or-table").html() == "设备IMEI号" || $(".school-or-table").html() == "设备手机号"){
            return;
        }
        var val = $(e.target).val();
        this.schoolArray(val,$(e.target).attr("data-list"));
    },
    /**
     * 在地图上显示安全区域
     * @returns {XML}
     */
    onClickShowSafeArea: function (data) {
       removeOverlay(markerStrom);//移除上一个覆盖物
        var marker = "";
        if(data[0].centerlat != null ||　data[0].centerlon != null) {//圆
            var point = new BMap.Point(parseFloat(data[0].centerlon)/1000000, parseFloat(data[0].centerlat)/1000000);
            marker = new BMap.Circle(point,data[0].radius,{strokeColor:"#01b4ee", strokeWeight:2, strokeOpacity:0.5,fillColor:"rgba(105, 200, 230, 0.45)"}); //创建圆
            map.centerAndZoom(point, 16);
        }else{//矩形
            marker = new BMap.Polygon([
                new BMap.Point(parseFloat(data[0].maxlat)/1000000,parseFloat(data[0].minlon)/1000000),
                new BMap.Point(parseFloat(data[0].maxlat)/1000000,parseFloat(data[0].maxlon)/1000000),
                new BMap.Point(parseFloat(data[0].minlat)/1000000,parseFloat(data[0].maxlon)/1000000),
                new BMap.Point(parseFloat(data[0].minlat)/1000000,parseFloat(data[0].minlon)/1000000)
            ], {strokeColor:"#01b4ee", strokeWeight:2, strokeOpacity:0.5,fillColor:"rgba(105, 200, 230, 0.45)"});  //创建矩形
            var point = new BMap.Point(parseFloat(data[0].maxlat)/1000000,parseFloat(data[0].minlon)/1000000);
            map.centerAndZoom(point, 16);
        }
        markerStrom = marker;
        map.addOverlay(marker);
    },
    render: function () {
        var svar = this;
        var onClickArray = [this.onClickUpdate,this.onClickDelete,this.onClickShowSafeArea];
        var Tabels = this.state.tableData.map(function (data,index) {
            return (
                <Table key={data.key} listNumber={index} onClickShowSafeArea={onClickArray[2].bind(svar,[data])} onClickUpdate={onClickArray[0].bind(svar,[data.regionaddr,data.regionid])} onClickDelete={onClickArray[1].bind(svar,data.regionid)} regionid={data.regionid} regionname={data.regionname} regionaddr={data.regionaddr} radius={data.radius} createtime={data.createtime} createuser={data.createuser} regiontype={data.regiontype} minlon={data.minlon} minlat={data.minlat} maxlon={data.maxlon} maxlat={data.maxlat} centerlon={data.centerlon} centerlat={data.centerlat} />
            )
        });
        return (
            <div className="tableManage-body">
                <div  className="popAddMessage popModel">
                    <div className="model"></div>
                    <div className="popAddMessage-info popModel-info" style={{width:"560px"}}>
                        <div className="popModel-title">
                            <span className="popModel-title-content">
                                <span className="popModel-title-content-solid-left"/>
                                安全区域
                                <span className="popModel-title-content-solid-right"/>
                            </span>
                            <span className="popModel-title-img" onClick={this.onClickHidePop}><img src="../img/icon/close.png" alt="关闭"/></span>
                        </div>
                        <div className="popModel-body">
                            <div className="popModel-body-input " >
                                <span className="popModel-body-input-title">安全区域名称</span>
                                <span className="popModel-body-input-content" >
                                    <input style={{marginTop: "0px"}} id="addressName"  type="text" readOnly="readOnly" placeholder="请输入安全区域名称"  />
                                </span>
                            </div>
                            <div className="popModel-body-input">
                                <span className="popModel-body-input-title">安全区域地址</span>
                                <span className="popModel-body-input-content" >
                                    <input style={{marginTop: "0px"}} id="suggestId" type="text" maxLength="50" placeholder="请输入区域地址"  />
                                    <div id="searchResultPanel" style={{border:"1px solid #C0C0C0",width:"150px",height:"auto",display:"none"}}></div>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                <header>
                    <div className="header-menu">
                        <ul>
                            <li className="select">地图监控</li>
                            <li onClick={this.onClickMenu}>列表监控</li>
                        </ul>
                        <div className="header-right">
                            <div className="header-right-select droup-select">
                                <div className="school-or-table">学校</div>
                                <span className="lower-right-corner"/>
                                <div className="drop-down">
                                    <span className="select-value school-name" >学校</span>
                                    <span className="select-value school-name" >设备IMEI号</span>
                                    <span className="select-value student-name" >设备手机号</span>
                                </div>
                            </div>
                            <div className="header-right-query">
                                <div className="header-right-query-input">
                                    <input className="queryVal enterEvent" type="text" onChange={this.onChangSchoolInput} onClick={this.onClickSchool}  data-list="querySchoolTable" maxLength="50" id="searchName" name="searchName"  placeholder="请输入学校关键字"/>
                                </div>
                                <div className="header-right-query-img-user" onClick={this.onClickQuery}></div>
                                <div className="schoolList querySchoolTable" data-inputId="searchName">
                                    {
                                        schoolDataList.map(function (data) {
                                            return (
                                                <span className="schoolList-value" onClick={svar.onClickQuerySchoolList}>{data.schoolname}</span>
                                            )
                                        })
                                    }
                                </div>
                            </div>
                        </div>
                    </div>
                </header>
                <div className="map" id="map">

                </div>
                <div className="tableInfo " style={{display:"none"}}>
                    <div className="statistical-analysis-content studentsInfo-data-table ">
                        <div className="table-top-info">
                            <div className="table-top-info-left">安全区域设置列表</div>
                            <div className="table-top-info-right reset" onClick={reset}>
                                <span className="table-top-info-right-add">
                                    <img src="../img/icon/reset.png" />
                                    <span>重置</span>
                                </span>
                            </div>
                            <div className="table-top-info-right removeMap" onClick={removeMap}>
                                <span className="table-top-info-right-add">
                                    <img src="../img/icon/deselect.png" />
                                    <span>取消</span>
                                </span>
                            </div>
                            <div className="table-top-info-right saveMap">
                                <span className="table-top-info-right-add " onClick={this.saveMap}>
                                    <img src="../img/icon/save.png" />
                                    <span>保存</span>
                                </span>
                            </div>
                            <div className="table-top-info-right updateMap">
                                <span className="table-top-info-right-add " onClick={this.updateMap}>
                                    <img src="../img/icon/update.png" />
                                    <span>修改</span>
                                </span>
                            </div>
                            <div className="table-top-info-right addMap">
                                <span className="table-top-info-right-add" onClick={this.onClickAdd}>
                                    <img src="../img/icon/add-white.png" />
                                    <span>添加</span>
                                </span>
                            </div>
                        </div>
                        <div className="studentsInfo-data tableInfo-data">
                            <table className="head-body head-body">
                                <thead>
                                    <th>序号</th>
                                    <th>安全区域名称</th>
                                    <th>中心位置</th>
                                    <th>范围距离</th>
                                    <th style={{display:"none"}}>警报方式</th>
                                    <th>创建日期</th>
                                    <th>创建人</th>
                                    <th>操作</th>
                                </thead>
                                <tbody id="tbodyData">
                                    {this.state.tableData==""?'':Tabels}
                                </tbody>
                            </table>
                            {this.state.tableData==""?<div className="tableNoData">{tableNoDataCount}</div>:''}
                        </div>
                    </div>
                    <Page otherData={this.state.otherData} onPageClick={this.onPageClick} />
                </div>
                <footer id="copyright">
                    <span><img src="../img/icon/copyright.png"/>{copyright}</span>
                </footer>
            </div>
        )
    }
});
ReactDOM.render(
    <Main  otherData={otherData} tableData={tableData} schoolDataList={schoolDataList} schoolDataAll={schoolDataAll} />,
    document.getElementById('tableManage')
);
//点击下拉框
$(".header-right-select").click(function () {
    var dropDown = $(this).find('.drop-down');
    if(dropDown.is(":hidden")){
        dropDown.slideDown();
    }else{
        dropDown.slideUp();
    }
});
//选择学校、imei、手机号
$('.drop-down > span').click(function() {
    $(".queryVal").attr("placeholder","请输入"+$(this).html()+"关键字");
    var value = $(this).html();
    if(value == "学校" && $(".school-or-table").html() != "学校"){
        $("#addressName").val("学校");
        $("#addressName").attr("readOnly",true);
        $("#searchName").val("");
    }else if(value == "设备IMEI号" && $(".school-or-table").html() != "设备IMEI号"){
        $("#addressName").val("");
        $("#addressName").attr("readOnly",false);
        $("#searchName").val("");
    }else if(value == "设备手机号" && $(".school-or-table").html() != "设备手机号"){
        $("#searchName").val("");
        $("#addressName").val("");
        $("#addressName").attr("readOnly",false);
    }
    $(".school-or-table").html($(this).html());
    $('.drop-down').slideUp();
});
//学校下拉列表
$("*").bind("click",function(e){
    var target = $(e.target);
    if(target.closest(".schoolList-value").length == 1){
        $("#"+$(target.parent()).attr("data-inputId")+"").val(target.html());
        $(".schoolList").hide();
    }else{
        $(".schoolList").hide();
    }
});